<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>管理阶段</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	
	<link rel="stylesheet" href="css/vivo.css">
	<link rel="stylesheet" href="css/common.css">
	<link rel="stylesheet" href="css/bootstrap.css">
	<link rel="stylesheet" href="js/bootstrap2/css/bootstrap.min.css">
	<link rel="stylesheet" href="css/common.css">
	<link rel="stylesheet" type="text/css" href="js/webuploader-0.1.5/webuploader.css" />
	
	<script src="js/jquery-1.11.1.js"></script>
	<script type="text/javascript"
	src="<%=basePath%>js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="js/webuploader-0.1.5/webuploader.js"></script>
<script type="text/javascript" src="js/sharefunction.js"></script>
	<script type="text/javascript" src="js/layui-v2.1.5/layui/layui.all.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="js/form.js"></script>
	<!-- 图片放大 -->
	<script src="js/postbird-img-glass/postbird-img-glass.js"></script>
  </head>
  
  <script type="text/javascript">
	  $(function(){
			//如果已经保存过了，则开启只读状态
			<c:if test="${not empty requestScope.manageStage }">
				$("#manageStage").find("input").attr("readonly",true);
				$("#manageStage .Wdate").attr("disabled",true);
			</c:if>
			//悬浮提示
			toolTip();
			//修改字段标记记录变量
			<c:set var="marks" value="原数据"/>
			getFiles();
	  })
	  		
			
	  	//展示附件
	  	var acIds ="";//新增附件id集合
		function getFiles() {
		  	//原附件状态为1
		  	getFileListByFlag($("#manageStage #entityId_id").val(), "竣工图",2, "#list_jgt", imgPlus);
		  	<c:if test="${requestScope.notPassExamine}">
			  	var caList = ${requestScope.caList};
			  	//获取序列化操作时的图片数据
				for(var i = 0;i<caList.length;i++){
					acIds += caList[i].accessoryCAId+",";
				} 
				acIds = acIds.substring(0,acIds.length-1);
				getFileListByAcId(acIds,"#list_jgt",imgPlus);
			</c:if>
		}
	  
	  function imgPlus(data) {
			$.each(data, function(i, v) {
				//图片放大
				PostbirdImgGlass.init({
					domSelector : "#" + v.id + " img",
					animation : true,
					myDocument : window.parent.parent.parent
				});
			});
			$("#manageStage .uploadcancel").css("display", "none");
		}
  </script>
  <body>
  <div style="padding:0px 10px">
  <form id="manageStage" method="post" action="" onsubmit="return false;">
  	<input type="hidden" id="manageStage_articleId">
		<div class="panel panel-default">
			<div class="panel-heading">
      			<h5 class="panel-title">管理阶段</h5>
   			</div>
			<div class="panel-body">
				<table cellpadding="10" cellspacing="5" class="mytable" >
					<tr>
						<td width="70" class="td-right">管理时间</td>
						<td width="260"><input id="manageDate" name="manageDate" readonly="readonly" value="<fmt:formatDate value="${requestScope.manageStage.manageDate }" pattern="yyyy-MM-dd" />" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
							<c:if test="${not empty requestScope.map.manageDate }"><span class="toolTip mark-msg" data-tip="<fmt:formatDate  value="${requestScope.map.manageDate }" type="both" pattern="yyyy-MM-dd" />">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.manageDate=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
						<td width="70" class="td-right">管理单位</td>
						<td><input name="manageUnit" value="${requestScope.manageStage.manageUnit }" class="input_name"/>
							<c:if test="${not empty requestScope.map.manageUnit }"><span class="toolTip mark-msg"data-tip="${requestScope.map.manageUnit }">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.manageUnit=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
					</tr>
					<tr>
						<td class="td-right">审批地名</td>
						<td><input  name="approvalToponymy" value="${requestScope.manageStage.approvalToponymy }" />
							<c:if test="${not empty requestScope.map.approvalToponymy }"><span class="toolTip mark-msg"data-tip="${requestScope.map.approvalToponymy }">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.approvalToponymy=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
						<td class="td-right">产权所有</td>
						<td><input name="equityOwnership" value="${requestScope.manageStage.equityOwnership }" />
							<c:if test="${not empty requestScope.map.equityOwnership }"><span class="toolTip mark-msg"data-tip="${requestScope.map.equityOwnership }">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.equityOwnership=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
					</tr>
					<tr>
						<td class="td-right">开始时间</td>
						<td><input  name="staDate" id="staDate" readonly="readonly" class="Wdate" value="<fmt:formatDate value="${requestScope.manageStage.staDate }" pattern="yyyy-MM-dd" />" onClick="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')}',minDate:'#F{$dp.$D(\'manageDate\')}'})"/>
							<c:if test="${not empty requestScope.map.staDate }"><span class="toolTip mark-msg" data-tip="<fmt:formatDate  value="${requestScope.map.staDate }" type="both" pattern="yyyy-MM-dd" />">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.staDate=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
						<td class="td-right">结束时间</td>
						<td><input  name="endDate" id="endDate" readonly="readonly" class="Wdate" value="<fmt:formatDate value="${requestScope.manageStage.endDate }" pattern="yyyy-MM-dd" />" onClick="WdatePicker({minDate:'#F{$dp.$D(\'staDate\')}'})"/>
							<c:if test="${not empty requestScope.map.endDate }"><span class="toolTip mark-msg" data-tip="<fmt:formatDate  value="${requestScope.map.endDate }" type="both" pattern="yyyy-MM-dd" />">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.endDate=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
					</tr>
					<tr>
						<td class="td-right">管理范围</td>
						<td colspan="3"><input name="manageScope" value="${requestScope.manageStage.manageScope }" />
							<c:if test="${not empty requestScope.map.manageScope }"><span class="toolTip mark-msg"data-tip="${requestScope.map.manageScope }">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.manageScope=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
					</tr>
					<tr>
						<td class="td-right">竣工图</td>
						<td colspan="3"><input name="completionMap" id="completionMap" value="${requestScope.manageStage.completionMap }" />
							<c:if test="${not empty requestScope.map.completionMap }"><span class="toolTip mark-msg"data-tip="${requestScope.map.completionMap }">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.completionMap=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
							 <!-- 上传按钮 -->
							<div id='filePicker_jgt' style="display:none;">上传</div>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<!-- 附件上传 管理阶段———竣工图。。。--> <!-- 缩略图容器 -->
							<div id='list_jgt'></div>
						</td>
					</tr>
				</table>
			</div>
		</div>
		<input type="hidden" id="entityId_id" name="id" value="${requestScope.manageStage.id }"/>
		<input type="hidden" id="apId" name="apId" value="${requestScope.apId }"/>
		<c:if test="${requestScope.notPassExamine}">
			<!-- 修改时添加变更说明 -->
			<div style="margin:10px;" id="approvalRemark">
				审批意见<textarea rows="3" name="approvalRemark"style="width:70%"></textarea><span style="color:red;">*</span>
			</div>
			<div style="width:100%;text-align:center; padding-top:0px">
				<button class="btn btn-danger radius my-btn"
					onclick="saveManage(0)" type="button">同意</button>
				<button class="btn btn-default radius"
					onclick="saveManage(1)" type="button">拒绝</button>
			</div>
		</c:if>
	</form>
  </div>
  <script type="text/javascript">
  function saveManage(opt){
		var apId = '${requestScope.apId }';
		var exDataId = '${exDataId}';
		var approvalRemark = $("#manageStage textarea[name='approvalRemark']").val();
		var i = layer.load(2);
		var url="project/approval/disposeManage";
		if(exDataId!=""){
			if(approvalRemark==""){
				layer.alert("变更说明不能为空");
				layer.close(i);
				return null;
			}else{
				jQuery.ajax({
				    type:"post",
				    async:false,
				    url:url,
			        dataType:"json",
			        traditional: true,
			        data:{
			        	exDataId:exDataId,
			        	opt:opt,
			        	apId:apId,
			        	approvalRemark:approvalRemark
			        },
				    success:function(responseText){
				    	layer.close(i);
				        if(responseText.success){
				        	layer.alert("保存成功！", {
				        		offset:'20%',
				        		shade:[0.1,'#fff']
							}, function() {
								parent.location.reload();
								parent.parent.getPendingCount();
								parent.parent.getPendingPassCount();
								parent.parent.getPendingBackCount();
							});
			  			}else{
			  				alert(responseText.msg, {icon: 7});
			  				layer.closeAll();
			  			}
				    }
				});
			}
		}
	}
	 
  	
  </script>
  </body>
</html>

